package xyz.xtt.admin.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import xyz.xtt.admin.entity.TblAuditLog;
import xyz.xtt.admin.request.AuditLogRequest;
import xyz.xtt.admin.service.IAuditLogService;
import xyz.xtt.admin.utils.PageUtilV2;
import xyz.xtt.admin.vo.AuditLogVo;
import xyz.xtt.common.response.ApiResult;

import java.text.ParseException;
import java.util.Optional;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-11-28
 */
@RestController
@RequestMapping("/api/admin/audit_log")
public class AuditLogController {

    @Autowired
    private IAuditLogService auditLogService;
    @Autowired
    private PageUtilV2 pageUtil;

    @GetMapping("/list")
    public ApiResult<Page<AuditLogVo>> getList(AuditLogRequest auditLogRequest) throws Exception {
        auditLogRequest.setCurrent(pageUtil.getCurrent(auditLogRequest.getCurrent()));
        auditLogRequest.setPage(pageUtil.getPageSize(auditLogRequest.getPage()));
        return  ApiResult.ok(auditLogService.getList(auditLogRequest));
    }

}
